<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>新增渠道</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="../lib/layui/css/layui.css">
    <link rel="stylesheet" href="../css/font.css">
    <link rel="stylesheet" href="../css/xadmin.css">
    <script type="text/javascript" src="../lib/layui/layui.all.js" charset="utf-8"></script>
    <script type="text/javascript" src="../js/jquery.min.js" charset="utf-8"></script>
    <script type="text/javascript" src="../js/xadmin.js"></script>
    <script type="text/javascript" src="../js/commonutil.js"></script>
    <script src="./function.js" charset="utf-8"></script>
</head>
<body>
    <div class="edit-form-class" style="padding-top: 20px;">
        <form class="layui-form" id="addChannelForm">
            <div class="layui-form-item">
                <label class="layui-form-label">渠道名称</label>
                <div class="layui-input-block">
                    <input type="text" id="channelName" name="channelName" lay-verify="required|channelNameVerify"  style="width: 350px" autocomplete="off" placeholder="" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">渠道别名</label>
                <div class="layui-input-block">
                    <input type="text" id="channelAlias" name="channelAlias" lay-verify="required|channelAliasVerify"  style="width: 350px" autocomplete="off" placeholder="" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">是否启用</label>
                <div class="layui-input-block" style="padding-top: 7px">
                    <input type="checkbox" checked="" name="channelStatus" id="channelStatus" lay-skin="switch" lay-filter="required|channelStatusVerify" lay-text="启用|禁用">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit="" autocomplete="off" lay-filter="submitBtn" id="submitBtn">保存</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>
</body>

<script>
    jQuery(function(){
        layui.use(['laypage','jquery', 'layer', 'table', 'form',], function(){
            let form = layui.form;
            form.render();
        });
    });
    //提交
    $('#submitBtn').click(function () {
        let url = serverPre + "/manager/scs/v2/channel/save";
        let formData = serializeObject($("#addChannelForm"));
        let commitData = JSON.stringify({"channelName":formData.channelName,"channelAlias":formData.channelAlias,"channelStatus":formData.channelStatus === 'on' ? 1 : 0});
        submitForm(commitData,url);
    })
</script>
</html>
